#ifndef __WET_H_
#define __WET_H_

/*==========================================================*/
/*  -------- DBMS course, 236363, Spring 2012 -----------*/
/*==========================================================*/
/* This is a sample header file for the "wet" assignment.   */
/* This file should not be submitted, it'll be replaced     */
/* during the automatic tests. Therefore, DO NOT change     */
/* anything in this file except your USERNAME and PASSWORD. */

/* Update these two macros to your account's details */
#define USERNAME "sadambe"
#define PASSWORD "039208699"

/* DO NOT change the names of the macros -      */
/* your submitted program will fail compilation */
#define ILL_PARAMS              "Illegal parameters\n"
#define EXISTING_RECORD         "Already exists\n"
#define EMPTY                   "Empty\n"

#define FALSE    0
#define TRUE     1

/* Function names */
#define COMMAND_ADD_QUESTION				"addQuestion"
#define COMMAND_EDIT_QUESTION				"editQuestion"
#define COMMAND_DELETE_QUESTION				"deleteQuestion"
#define COMMAND_ADD_TAG						"addTag"
#define COMMAND_REMOVE_TAG					"removeTag"
#define COMMAND_PRINT_TAGS					"printTags"
#define COMMAND_ADD_ANSWER					"addAnswer"
#define COMMAND_EDIT_ANSWER					"editAnswer"
#define COMMAND_DELETE_ANSWER				"deleteAnswer"
#define COMMAND_APPROVE_ANSWER				"approveAnswer"
#define COMMAND_FIND_ANSWERS				"findAnswers"
#define COMMAND_SEARCH_BY_TAG				"searchByTag"
#define COMMAND_FIND_RELATED_TAGS			"findRelatedTags"
#define COMMAND_FIND_RELATED_QUESTIONS		"findRelatedQuestions"
#define COMMAND_PRINT_STATISTICS			"printStatistics"
#define COMMAND_INTERESTING_TAGS			"interestingTags"
#define COMMAND_BEST_ANSWERS_FOR_TAG		"bestAnswersForTag"
#define COMMAND_DELETE_REDUNDANT_ANSWERS	"deleteRedundantAnswers"
#define COMMAND_EXIT "exit"

#define QUESTIONS_TABLE_HEADER					".------------------.----------------------------------------------------.----------------------.------------------.-------.\n" \
												"|    question id   |                      question                      |         user         |       date       | #tags |\n" \
												".------------------.----------------------------------------------------.----------------------.------------------.-------.\n"
#define QUESTIONS_TABLE_LINE					"| %-16s | %-50s | %-20s | %-16s | %-5s |\n"

#define TAGS_TABLE_HEADER						".--------------------------------.\n" \
												"|               tag              |\n" \
												".--------------------------------.\n"
#define TAGS_TABLE_LINE							"| %-30s |\n"

#define ANSWERS_TABLE_HEADER					".------------------.------------------.----------------------------------------------------.-----------.\n" \
												"|     answer id    |    question id   |                       answer                       | #approves |\n" \
												".------------------.------------------.----------------------------------------------------.-----------.\n"
#define ANSWERS_TABLE_LINE						"| %-16s | %-16s | %-50s | %-9s |\n"

#define ANSWERS_FOR_QUESTION_TABLE_HEADER		".------------------.----------------------------------------------------.-----------.\n" \
												"|     answer id    |                      answer                       | #approves |\n" \
												".------------------.----------------------------------------------------.-----------.\n"
#define ANSWERS_FOR_QUESTION_TABLE_LINE			"| %-16s | %-50s | %-9s |\n"

#define STATISTICS_TABLE_HEADER					".--------------------------------.-----------.-----------.-------------.----------.\n" \
												"|              tag               | #question | #answered | #unanswered | #related |\n" \
												".--------------------------------.-----------.-----------.-------------.----------.\n"
#define STATISTICS_TABLE_LINE					"| %-30s | %-9s | %-9s | %-11s | %-8s |\n"

#define INTERESTING_TABLE_HEADER				".--------------------------------.-------------.----------------------------------------------------.----------.-----------.\n" \
												"|              tag               | question id |                      question                      | #answers | #approves |\n" \
												".--------------------------------.-------------.----------------------------------------------------.----------.-----------.\n"
#define INTERESTING_TABLE_LINE					"| %-30s | %-11s | %-50s | %-10s | %-11s |\n"

#define BEST_TABLE_HEADER						".-------------.----------------------------------------------------.-------------.----------------------------------------------------.\n" \
												"| question id |                      question                      |  answer id  |                       answer                       |\n" \
												".-------------.----------------------------------------------------.-------------.----------------------------------------------------.\n"
#define BEST_TABLE_LINE							"| %-11s | %-50s | %-11s | %-50s |\n"

void* addQuestion(const char* question, const char* username, const char* date);
void* editQuestion(const int qid, const char* question);
void* deleteQuestion(const int qid);
void* addTag(const int qid, const char* tag);
void* removeTag(const int qid, const char* tag);
void* printTags(const int qid);
void* addAnswer(const int qid, const char* answer);
void* editAnswer(const int aid, const char* answer);
void* deleteAnswer(const int aid);
void* approveAnswer(const int aid);
void* findAnswers(const int qid);
void* searchByTag(const char* tag);
void* findRelatedTags(const char* tag);
void* findRelatedQuestions(const int qid);
void* printStatistics();
void* interestingTags();
void* bestAnswersForTag(const char* tag);
void* deleteRedundantAnswers();

void parseInput();

#endif  /* __WET_H_ */
